import Page
from Page import Carpark
from Base.Base import Base
from selenium.webdriver.common.by import By


class CarparkRecommendPage(Base):
    """
    车乐汇推荐首页

    个性主题的语音音色页、全息形象页、整车音效页可复用此页
    """

    def __init__(self, driver):
        Base.__init__(self, driver)

        # 左侧的home键
        self.recommend_home_btn = (By.XPATH, Carpark.RESOURCE_ID.format("ivHome"))

        # 左侧的返回键
        self.recommend_back_btn = (By.XPATH, Carpark.RESOURCE_ID.format('ivBack'))

        # 推荐页tab
        self.recommend_tab_name_btn = (By.XPATH, Carpark.RESOURCE_ID.format("tab_recommend"))

        # 游戏tab
        self.recommend_tab_game_btn = (By.XPATH, Carpark.RESOURCE_ID.format("tab_game"))

        # 暂无数据图片
        self.recommend_no_data_img = (By.XPATH, Carpark.RESOURCE_ID.format("iv_tips"))

        # 暂无数据文案
        self.recommend_no_data_tip_text = (By.XPATH, Carpark.RESOURCE_ID.format("tv_tips"))

    def click_home(self):
        """
        点击左侧的home键

        :return:None
        """
        self.click_element(self.recommend_home_btn)

    def click_back(self):
        """
        点击左侧的back键

        :return:None
        """
        self.click_element(self.recommend_back_btn)

    def click_tab_name(self):
        """
        点击推荐tab

        :return:None
        """
        self.click_element(self.recommend_tab_name_btn)

    def click_tab_game(self):
        """
        点击游戏tab

        :return:None
        """
        self.click_element(self.recommend_tab_game_btn)

    def get_tab_game_select(self):
        """
        获取选择tab属性

        :return:获取属性
        """
        return self.find_element_o(self.recommend_tab_game_btn)

    def get_no_data(self):
        """
        获取暂无数据图片

        :return:None
        """
        return self.find_element_o(self.recommend_no_data_img)

    def get_no_data_tip(self):
        """
        获取暂无数据文案

        :return:None
        """
        return self.find_element_o(self.recommend_no_data_tip_text)

    def is_display_carpark_recommend(self):
        """
        查看是否进入车乐汇推荐首页

        :return:
        """
        return self.is_display(self.recommend_no_data_tip_text)
